<!doctype html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="hexo," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="写在前面为什么要搭建专属博客？每个人有每个人想法。很显然，反正你看到了这篇文章就说明你有一些想法。
不多赘述，开始搭建。
注意：本篇针对win7 x64">
<meta property="og:type" content="article">
<meta property="og:title" content="搭建个人免费博客：利用Hexo在码云上部署博客">
<meta property="og:url" content="http://yoursite.com/2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/index.html">
<meta property="og:site_name" content="远方的田野">
<meta property="og:description" content="写在前面为什么要搭建专属博客？每个人有每个人想法。很显然，反正你看到了这篇文章就说明你有一些想法。
不多赘述，开始搭建。
注意：本篇针对win7 x64">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/1.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/2.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/3.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/4.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/5.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/6.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/7.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/8.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/9.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/10.png">
<meta property="og:image" content="http://okbrg0sur.bkt.clouddn.com/11.png">
<meta property="og:updated_time" content="2017-02-09T03:22:57.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="搭建个人免费博客：利用Hexo在码云上部署博客">
<meta name="twitter:description" content="写在前面为什么要搭建专属博客？每个人有每个人想法。很显然，反正你看到了这篇文章就说明你有一些想法。
不多赘述，开始搭建。
注意：本篇针对win7 x64">
<meta name="twitter:image" content="http://okbrg0sur.bkt.clouddn.com/1.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '苦逼的小编'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/"/>





  <title> 搭建个人免费博客：利用Hexo在码云上部署博客 | 远方的田野 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  



  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?e417506f572cec8b5148f4903cd137e8";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>








  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">远方的田野</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
    
      <h1 class="site-subtitle" itemprop="description">Thought is the power.---(France)Hugo</h1>
    
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-sitemap">
          <a href="/sitemap.xml" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br />
            
            Sitemap
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>


    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="JM Lin">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="http://okbrg0sur.bkt.clouddn.com/super-mario-2003942_1920.jpg">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="远方的田野">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="远方的田野" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">
            
            
              
                搭建个人免费博客：利用Hexo在码云上部署博客
              
            
          </h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2017-01-25T15:34:27+08:00">
                2017-01-25
              </time>
            

            

            
          </span>

          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="写在前面"><a href="#写在前面" class="headerlink" title="写在前面"></a>写在前面</h1><pre><code>为什么要搭建专属博客？每个人有每个人想法。很显然，反正你看到了这篇文章就说明你有一些想法。
不多赘述，开始搭建。
注意：本篇针对win7 x64
</code></pre><a id="more"></a>
<h1 id="工具介绍"><a href="#工具介绍" class="headerlink" title="工具介绍"></a>工具介绍</h1><p>大家想了解工具的，看官方文档。</p>
<ol>
<li><p>码云pages，参考 <a href="https://git.oschina.net/" target="_blank" rel="external">https://git.oschina.net/</a></p>
</li>
<li><p>Hexo：<a href="https://hexo.io/zh-cn/" target="_blank" rel="external">https://hexo.io/zh-cn/</a></p>
</li>
</ol>
<h1 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h1><h2 id="1、安装node-js"><a href="#1、安装node-js" class="headerlink" title="1、安装node.js"></a>1、安装node.js</h2><p>参考 <a href="http://www.runoob.com/nodejs/nodejs-install-setup.html" target="_blank" rel="external">http://www.runoob.com/nodejs/nodejs-install-setup.html</a></p>
<h2 id="2、安装Git"><a href="#2、安装Git" class="headerlink" title="2、安装Git"></a>2、安装Git</h2><p>参考 <a href="http://www.runoob.com/git/git-install-setup.html" target="_blank" rel="external">http://www.runoob.com/git/git-install-setup.html</a></p>
<h2 id="3、安装Hexo"><a href="#3、安装Hexo" class="headerlink" title="3、安装Hexo"></a>3、安装Hexo</h2><p>安装好node.js、git后，打开cmd窗口（开始—-&gt;搜索框输入“cmd”，回车），输入下面代码：<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g hexo-cli</div></pre></td></tr></table></figure></p>
<p>安装完成后输入<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo</div></pre></td></tr></table></figure></p>
<p>显示如下图，则安装成功！<br><img src="http://okbrg0sur.bkt.clouddn.com/1.png" alt="1"><br>关于Hexo的更多使用，参考官方文档：<a href="https://hexo.io/zh-cn/docs/" target="_blank" rel="external">https://hexo.io/zh-cn/docs/</a></p>
<h1 id="正式搭建博客"><a href="#正式搭建博客" class="headerlink" title="正式搭建博客"></a>正式搭建博客</h1><h2 id="1、本地运行Hexo"><a href="#1、本地运行Hexo" class="headerlink" title="1、本地运行Hexo"></a>1、本地运行Hexo</h2><p>在你喜欢的硬盘下建一个项目文件夹（名称随你喜欢，Blog、Hexo等等都可以），在该文件夹下，按鼠标右键出现如下图，<br><img src="http://okbrg0sur.bkt.clouddn.com/2.png" alt="2"><br>选择Git Bash Here，进入如下窗口：<br><img src="http://okbrg0sur.bkt.clouddn.com/3.png" alt="3"><br>在窗口中输入：<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install</div></pre></td></tr></table></figure></p>
<p>再输入：<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">hexo generate</div></pre></td></tr></table></figure></p>
<p>然后在该文件夹下一般会出现如下文件：<br><img src="http://okbrg0sur.bkt.clouddn.com/4.png" alt="4"><br>有的电脑上项目文件夹下没有 .deploy_git、public和db，没事。<br>到了这里，你已经建好了一个博客，不过现在只能在本地运行。本地运行预览方法如下（以后都可以通过以下代码预览）：<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">npm install</div><div class="line">hexo server</div></pre></td></tr></table></figure></p>
<p>在浏览器中输入 <a href="http://localhost:4000" target="_blank" rel="external">http://localhost:4000</a> 就可以看到刚刚搭建好的博客了。如图：<br><img src="http://okbrg0sur.bkt.clouddn.com/5.png" alt="5"></p>
<h2 id="2、将搭建好的博客部署到码云pages"><a href="#2、将搭建好的博客部署到码云pages" class="headerlink" title="2、将搭建好的博客部署到码云pages"></a>2、将搭建好的博客部署到码云pages</h2><p> 首先在  <a href="https://git.oschina.net/" target="_blank" rel="external">https://git.oschina.net/</a> 上注册一个账号。<br>登陆后，点击页面右上角加号，选新建项目，填写如下信息，创建。如下图：<br><img src="http://okbrg0sur.bkt.clouddn.com/6.png" alt="6"><br>创建完成后，得到项目的HTTPS，复制。<br><img src="http://okbrg0sur.bkt.clouddn.com/7.png" alt="7"><br>在原先打开的git bash here 窗口依次输入如下代码：<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">hexo generate</div><div class="line">npm install hexo-deployer-git --save</div></pre></td></tr></table></figure></p>
<p>然后打开项目根目录下的_config.yml 文件，修改最后的deploy属性，修改后如下<br><img src="http://okbrg0sur.bkt.clouddn.com/8.png" alt="8"><br>注意：repo的值是之前复制的码云项目上的HTTPS。<br>修改完，在git bash here 窗口输入下面代码：<br><figure class="highlight markdown"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">hexo generate</div><div class="line">hexo deploy</div></pre></td></tr></table></figure></p>
<p>然后会弹出一个对话框，输入你的码云账号密码，账号最好填写你注册时用到的邮箱。<br>到此，部署完成。进入码云你创建的项目，看是否已经有类似下面的文件，如果有，那么恭喜你部署成功啦！<br><img src="http://okbrg0sur.bkt.clouddn.com/9.png" alt="9"><br>然后，启动码云的pages功能，如图：<br><img src="http://okbrg0sur.bkt.clouddn.com/10.png" alt="10"><br>访问链接即进入你的博客：<br><img src="http://okbrg0sur.bkt.clouddn.com/11.png" alt="11"><br>至此，专属你的博客搭建成功了，你的专属域名：<a href="https://yourusername.oschina.io" target="_blank" rel="external">https://yourusername.oschina.io</a> 。<br>希望本文能给你带来帮助，如有疑惑欢迎联系我！关于使用hexo+GitHub搭建静态博客，网上有很多文章，大家自行百度，结合本文基本能够搭建成功。</p>
<p>关于hexo博客使用，请参考我的另一个博客： <a href="https://javaclear.github.io" target="_blank" rel="external">https://javaclear.github.io</a><br>或者 <a href="https://yanhuangshi.coding.me/yanhuangshi/" target="_blank" rel="external">https://yanhuangshi.coding.me/yanhuangshi/</a> 。这两个是同一博客，前面一个访问不了就访问第二个。</p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>欣赏本文？求打赏！求鼓励！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="http://okbrg0sur.bkt.clouddn.com/wechatpay.png" alt="JM Lin WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="http://okbrg0sur.bkt.clouddn.com/alipay.png" alt="JM Lin Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/hexo/" rel="tag"># hexo</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/01/25/Hexo博客使用系列（引子）——如何优化/" rel="prev" title="Hexo博客使用教程（引子）————如何优化">
                Hexo博客使用教程（引子）————如何优化 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/"
     data-title="搭建个人免费博客：利用Hexo在码云上部署博客"
     data-content=""
     data-url="http://yoursite.com/2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>

          
          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/"
           data-title="搭建个人免费博客：利用Hexo在码云上部署博客" data-url="http://yoursite.com/2017/01/25/搭建个人免费博客：利用Hexo在码云上部署博客/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="http://okbrg0sur.bkt.clouddn.com/super-mario-2003942_1920.jpg"
               alt="JM Lin" />
          <p class="site-author-name" itemprop="name">JM Lin</p>
          <p class="site-description motion-element" itemprop="description">求一佳偶，相伴诗意人生</p>
        </div>
        <nav class="site-state motion-element">
        
          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">5</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/Javaclear/" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://okbrg0sur.bkt.clouddn.com/%E5%85%AC%E4%BC%97%E5%8F%B7%E4%BA%8C%E7%BB%B4%E7%A0%81" target="_blank" title="微信公众号">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微信公众号
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://weibo.com/5752521860/profile?topnav=1&wvr=6&is_all=1" title="微博" target="_blank">微博</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=1461025291&amp;site=qq&amp;menu=yes" title="有问题请点我" target="_blank">有问题请点我</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#写在前面"><span class="nav-number">1.</span> <span class="nav-text">写在前面</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#工具介绍"><span class="nav-number">2.</span> <span class="nav-text">工具介绍</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#准备工作"><span class="nav-number">3.</span> <span class="nav-text">准备工作</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1、安装node-js"><span class="nav-number">3.1.</span> <span class="nav-text">1、安装node.js</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2、安装Git"><span class="nav-number">3.2.</span> <span class="nav-text">2、安装Git</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3、安装Hexo"><span class="nav-number">3.3.</span> <span class="nav-text">3、安装Hexo</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#正式搭建博客"><span class="nav-number">4.</span> <span class="nav-text">正式搭建博客</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1、本地运行Hexo"><span class="nav-number">4.1.</span> <span class="nav-text">1、本地运行Hexo</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2、将搭建好的博客部署到码云pages"><span class="nav-number">4.2.</span> <span class="nav-text">2、将搭建好的博客部署到码云pages</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">JM Lin</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

<div class="busuanzi-count">

  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv"><i class="fa fa-user"></i><span class="busuanzi-value" id="busuanzi_value_site_uv"></span></span>
  

  
    <span class="site-pv"><i class="fa fa-eye"></i><span class="busuanzi-value" id="busuanzi_value_site_pv"></span></span>
  
  
</div>



        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"yuanfangdetianye"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  












  
  
  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body").append('<div class="popoverlay">').css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".popoverlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>


  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  


</body>
</html>
